import heapq


def heap_sort(nums):
    result = []
    for i in range(len(nums)):
        heapq.heapify(nums)
        result.append(nums.pop(0))
    return result


array = [95, 76, 66, 50, 36, 12, 24, 36]
print(heap_sort(array))
